<h1>Listing categories</h1>

<div>
<p>
<%= link_to 'New Category', new_category_path, :class => 'gray-btn' %>
</p>
</div>

<div>
<table class="datagrid">
  <thead>
  <tr>
    <th>Id</th>
    <th>Name</th>
    <th>Parent</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>
  </thead>
  <tbody>
<% @categories.each do |category| %>
  <tr>
    <td><%= category.id %></td>
    <td><%= category.name %></td>
    <td><%= category.parent_id %></td>
    <td><%= link_to 'Show', category %></td>
    <td><%= link_to 'Edit', edit_category_path(category) %></td>
    <!--  <td><a href="" class="edit">Edit </></td>  -->
    <td><%= link_to 'Destroy', category, method: :delete, data: { confirm: 'Are you sure?' } %></td>
  </tr>
<% end %>
  </tbody>
</table>

</div>

<br />
